//
//  ViewController.swift
//  SmartHousekeeper
//
//  Created by 刘森 on 2020/2/20.
//  Copyright © 2020 LS. All rights reserved.
//

import UIKit
import SnapKit

class ViewController: UIViewController {
    
    
    let tempView = UIView()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        self.view.backgroundColor = .white
        
        
        
        
        tempView.frame = CGRect(x: 100, y: 150, width: 100, height: 30)
        self.view.addSubview(tempView)
        tempView.backgroundColor = UIColor.blue
        
        tempView.lw_showRedDot(2)
        
        
        
        
        
        let inviteBtn = UIButton()
        inviteBtn.backgroundColor = .black
        inviteBtn.setTitle("邀请客人", for: .normal)
        self.view.addSubview(inviteBtn)
        inviteBtn.snp.makeConstraints { (make) in
            make.centerX.equalTo(self.view)
            make.centerY.equalTo(self.view).offset(-200)
            make.height.equalTo(50)
            make.width.equalTo(120)
            
        }
        inviteBtn.sce.add(.touchUpInside) { (btn) in
            let inviteFriendViewController = InviteFriendViewController.init()
            self.navigationController?.pushViewController(inviteFriendViewController, animated: true)
        }
        
        
        let houseBtn = UIButton()
        houseBtn.backgroundColor = .black
        houseBtn.setTitle("Housekeeper", for: .normal)
        self.view.addSubview(houseBtn)
        houseBtn.snp.makeConstraints { (make) in
            make.centerX.equalTo(self.view)
            make.centerY.equalTo(self.view).offset(-100)
            make.height.equalTo(50)
            make.width.equalTo(120)
            
        }
        houseBtn.addTarget(self, action: #selector(houseBtnPushAction), for: .touchUpInside)
        
        
        let SendFood = UIButton()
        SendFood.backgroundColor = .black
        SendFood.setTitle("SendFood", for: .normal)
        self.view.addSubview(SendFood)
        SendFood.snp.makeConstraints { (make) in
            make.centerX.equalTo(self.view)
            make.centerY.equalTo(self.view).offset(100)
            make.height.equalTo(50)
            make.width.equalTo(120)
            
        }
        SendFood.addTarget(self, action: #selector(sendFoodAction), for: .touchUpInside)
        
        
    }
    
    @objc private func houseBtnPushAction() {
        let houseKeepesViewController = HouseKeepesViewController.init()
        self.navigationController?.pushViewController(houseKeepesViewController, animated: true)
    }
    @objc private func sendFoodAction() {
        let houseKeepesViewController = SendFoodViewController.init()
        self.navigationController?.pushViewController(houseKeepesViewController, animated: true)
    }
    
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        tempView.lw_clearRedDot()
    }
    
    
    
    
}

